<template>
	<view class="pt-20 langu">
		<view class="listlang" v-for="item in list" :key="item.dictValue" @click="menuAction(item.dictValue)">
			<text :class="item.dictValue == $store.getters.lang ? 'sitxet' : ''">{{ item.remark }}</text>
			<image class="w-40 h-40" v-if="item.dictValue == $store.getters.lang" src="@/static/imgs/duihao.f2fcaeda.png" mode=""></image>
		</view>
	</view>
</template>

<script>
import { SET_LANG } from '@/store/modules/app';
import { getAllSetting, getLanguage } from '@/api/index.js';
export default {
	components: {},
	data() {
		return {
			langValue: 'zh',
			list: [
				{
					text: 'English',
					code: 'en'
				},

				{
					text: '简历中文',
					code: 'zh'
				}
			]
		};
	},
	created() {
		this.init();
	},
	onLoad() {},
	methods: {
		init() {
			getLanguage().then((res) => {
				if(res.code == 200){
					this.list = res.data;
				}
			});
		},
		menuAction(action) {
			if (action) {
				uni.setLocale(action);
				this.$store.commit(SET_LANG, action);
				// #ifndef APP-PLUS
				window.location.reload();
				
				// uni.reLaunch({
				// 	url: '/pages/index/index',
				// 	success() {
				// 		window.location.reload();
				// 	}
				// });
				// #endif
			}
		}
	}
};
</script>

<style lang="scss" scoped>
page {
	background-color: rgb(245, 245, 245);
}
.langu {
	background: rgb(245, 245, 245);
	font-size: 15px;
}
.listlang {
	display: flex;
	align-items: center;
	height: 55px;
	justify-content: space-between;
	background: rgb(255, 255, 255);
	padding: 0px 14px;
	border-bottom: 1px solid rgb(238, 238, 238);
	.sitxet {
		color: rgb(22, 100, 252);
	}
}
</style>
